#ifndef IMAGE_H
#define IMAGE_H

#include "Troll3D_global.h"
#include <GL/glew.h>
#include <QDebug>
#include <sstream>

typedef  unsigned char BYTE;

using namespace std;

/*! @brief The image class is used to store an image and eventually pass it to shaders
 */
class TROLL3DSHARED_EXPORT Image
{

    /********************************
    /*          Public
    /********************************/
    public :

        /********************************/
        /*          Constructor         */
        /********************************/

            Image();
            Image(const char * filePath);

        /********************************
        /*          Methods
        /********************************/

            void Load(const char * filePath);
            void GenTexture();

            void BindTexture(GLuint programId);

            void Debug();

        /********************************
        /*          Accessors
        /********************************/

            /*! @brief Return the width of the Image    */
            int Width();

            /*! @brief Return the height of the Image Object    */
            int Height();



        /********************************
        /*          Properties
        /********************************/

            int             m_Width;
            int             m_Height;
            int             BPP;
            BYTE*           m_Data;
            GLuint          m_TextureId;
            int             m_Size;

            bool            m_Init;



    /********************************
    /*          Private
    /********************************/

    private:

        bool    LoadTGA(const char *name);
        bool    SaveTGA(const char *name, int BPP=24 );



};

#endif
